﻿using HtmlGenerator;
using System.Drawing;
using System.Collections.Generic;

namespace 简易漫画阅读器
{
    class Ulti
    {
        public static string AddElement(List<string> path)
        {
            var html = new HtmlDocument();
            var body = html.Body;
            var div = body.AddChild(Tag.Div.WithStyle("text-align:center"));
            foreach (var item in path)
            {
                var img = Image.FromFile(item);
                if (img.Width > 1200)
                {
                    div.AddChild(Tag.Img.WithSrc(item).WithWidth("1200"));
                }
                else
                {
                    div.AddChild(Tag.Img.WithSrc(item));
                }
                img.Dispose();
            }
            return html.Serialize(HtmlSerializeType.NoSpace);
        }
    }
}